package org.bitterorange.flansmodslain.listeners;

import com.flansmod.common.eventhandlers.SoldierDeathEvent;
import com.flansmod.common.mob.EntitySoldier;
import com.flansmod.common.mob.api.SoldierAPI;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import org.bitterorange.flansmodslain.models.EntitySoldierWrapper;
import org.bukkit.Bukkit;

public class SoliderDeathListener {

    @Mod.EventHandler
    @SubscribeEvent
    public void onSoldierDeath(SoldierDeathEvent event) {
        if(SoldierAPI.isSoldier(event.getSoldier())) {
            EntitySoldierWrapper soldier = new EntitySoldierWrapper((EntitySoldier) event.getSoldier());
            Bukkit.getServer().getPluginManager().callEvent(new org.bitterorange.flansmodslain.models.SoldierDeathEvent(soldier, event.isSuicide(), event.isIgnoreDeathCheck()));
        }

    }

}
